const hre = require("hardhat");
const utils = require("./utils");
module.exports = {
    
    async router (factory) {
        // 路由合约
        const Router = await hre.ethers.getContractFactory("ChaingeSwap");
        const uniRouter = await Router.deploy(factory);
        await uniRouter.deployed();
        console.log("部署的router合约地址", uniRouter.address);
        return uniRouter
    },

    async addLiquidity(signers, uniRouter, addressA, addressB, config){
        console.log('-------------- addLiquidity --------------')
        const res = await uniRouter.addLiquidity(
            addressA,
            addressB,
            config.amountADesired,
            config.amountBDesired,
            config.amountAMin,
            config.amountBMin,
            signers.address,
            9999999999999,
            [config.startTime, config.endTime, config.startTime, config.endTime]
        )
        console.log('-------------- addLiquidity --------------')
        return res
    }
};
  